home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / fractal / kaos.lha / auxlib / create_aux_windows.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-19  |  7.9 KB  |  193 lines

  1. /*
  2. ### create combined space windows ###
  3. */
  4.  
  5. #include <suntool/sunview.h>
  6. #include <suntool/canvas.h>
  7. #include <suntool/panel.h>
  8. #include "../include/x11r2_kaos_def.h"
  9. #include "../modellib/class_kaos_def.h"
  10.  
  11. void create_aux_windows(awi)
  12. int awi;
  13. {
  14.         void aux_handle_event(),aux_resize_proc(),aux_win_mode_proc(),aux_quit_proc(),aux_copy_proc(),aux_x_proc(),aux_y_proc(),aux_repaint_proc();
  15.         int i;
  16.         extern Frame frame,*aux_frame;
  17.         extern Panel *aux_panel;
  18.         extern Canvas *aux_canvas;
  19.     extern Cursor *aux_cursor;
  20.         extern Pixwin **aux_pw;
  21.         extern Pixfont *courier10;
  22.         extern Panel_item *aux_quit_item,*aux_copy_item,*aux_win_mode_item,*aux_x_item,*aux_y_item,*aux_x_min_item,*aux_x_max_item,*aux_y_min_item,*aux_y_max_item;
  23.         extern char string[];
  24.     extern int panel_colormap_on;
  25.     extern int auto_option;
  26.         extern int model,my_colormap_size;
  27.     extern int var_dim,param_dim,func_dim,full_dim;
  28.         extern int aux_xcanvas,aux_ycanvas,aux_xwindow,aux_ywindow,aux_xwidth,aux_ywidth,aux_panel_height;
  29.         extern int *aux_on,*aux_win_mode,**aux_cur_index;
  30.         extern char string[],**all_label,**func_label;
  31.     extern double *all_min,*all_max,*param_min,*param_max;
  32.         extern double **aux_x_min,**aux_x_max,*win_var_i;
  33.         
  34.     /* Turn on the flag */    
  35.     if(aux_on[awi]){
  36.         window_set(aux_frame[awi],WIN_SHOW,TRUE,0);
  37.         return;
  38.     }
  39.     else
  40.         aux_on[awi]=1;
  41.  
  42.     /* Initialize the window size from phase space and parameter space box */
  43.     for(i=0;i<full_dim+param_dim;i++){
  44.         aux_x_min[i][awi]=all_min[i];
  45.         aux_x_max[i][awi]=all_max[i];
  46.     }
  47.     if(auto_option>0){
  48.         auto_translate_param(awi);
  49.     }
  50.  
  51.     /* Initialize the window configuration */
  52.         aux_xcanvas = aux_xwindow;
  53.         aux_ycanvas = aux_ywindow;
  54.         aux_xwidth = aux_xcanvas;
  55.         aux_ywidth = aux_ycanvas-aux_panel_height;
  56.  
  57.     /* Frame Label */
  58.         sprintf(string,"auxiliary space[%d]",awi);
  59.     /* Create aux frame */
  60.         aux_frame[awi] = window_create(frame,FRAME,
  61.                 FRAME_NO_CONFIRM,       TRUE,
  62.                 FRAME_LABEL,    string,
  63.                 FRAME_SHOW_LABEL,       TRUE,
  64.                 WIN_SHOW,       TRUE,
  65.                 WIN_X,  1152-aux_xwindow,
  66.                 WIN_Y,  aux_ywindow*awi,
  67.                 WIN_HEIGHT,     aux_ywindow,
  68.                 WIN_WIDTH,      aux_xwindow,
  69.                 0);
  70.     if(aux_frame[awi] == NULL) {
  71.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  72.         aux_on[awi] = 0;
  73.         return;
  74.     }
  75.     /* Create aux canvas */
  76.         aux_canvas[awi] = window_create(aux_frame[awi], CANVAS, CANVAS_RETAINED, FALSE,0);
  77.     if(aux_canvas[awi] == NULL) {
  78.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  79.         (void) destroy_aux_windows(awi);
  80.         return;
  81.     }
  82.     aux_cursor[awi]  = cursor_create(CURSOR_SHOW_CROSSHAIRS,TRUE,
  83.                        CURSOR_CROSSHAIR_COLOR,my_colormap_size-1,
  84.                        CURSOR_CROSSHAIR_LENGTH,10,0),
  85.         window_set(aux_canvas[awi],
  86.                 CANVAS_RETAINED,        TRUE,
  87.                 CANVAS_AUTO_SHRINK,     TRUE,
  88.                 CANVAS_AUTO_EXPAND,     TRUE,
  89.                 CANVAS_WIDTH,           aux_xcanvas,
  90.                 CANVAS_HEIGHT,          aux_ycanvas,
  91.                 WIN_CONSUME_KBD_EVENTS, WIN_ASCII_EVENTS,WIN_TOP_KEYS,WIN_RIGHT_KEYS,0,
  92.                 WIN_CONSUME_PICK_EVENTS,     WIN_MOUSE_BUTTONS, LOC_DRAG,0,
  93.                 WIN_EVENT_PROC,             aux_handle_event,
  94.                 WIN_CURSOR,     aux_cursor[awi],
  95.                 CANVAS_RESIZE_PROC,     aux_resize_proc,
  96.         /*
  97.                 CANVAS_REPAINT_PROC,    aux_repaint_proc,
  98.         */
  99.                 0);
  100.     /* Define Pixwin */
  101.         aux_pw[awi] = (Pixwin *) canvas_pixwin(aux_canvas[awi]);    
  102.     /* Load colormap */
  103.         aux_load_colormap(awi);
  104.     /* Create Panel */
  105.         aux_panel[awi] = window_create(aux_frame[awi], PANEL,
  106.                 WIN_X, 0,
  107.                 WIN_Y, 0,
  108.                 WIN_HEIGHT,     aux_panel_height,
  109.                 WIN_FONT, courier10,
  110.                 0);
  111.     if(aux_panel[awi] == NULL) {
  112.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  113.         (void) destroy_aux_windows(awi);
  114.         return;
  115.     }
  116.     /* Create panel items */
  117.         aux_quit_item[awi]= panel_create_item(aux_panel[awi], PANEL_BUTTON,
  118.                 PANEL_LABEL_Y, ATTR_ROW(0),
  119.                 PANEL_LABEL_X, ATTR_COL(0),
  120.                 PANEL_LABEL_IMAGE, panel_button_image(aux_panel[awi], "Quit", 4, courier10),
  121.                 PANEL_NOTIFY_PROC, aux_quit_proc,
  122.                 0);
  123.         aux_copy_item[awi] = panel_create_item(aux_panel[awi], PANEL_BUTTON,
  124.                 PANEL_LABEL_Y, ATTR_ROW(0),
  125.                 PANEL_LABEL_X, ATTR_COL(9),
  126.                 PANEL_LABEL_IMAGE, panel_button_image(aux_panel[awi], "Copy", 9, courier10),
  127.                 PANEL_NOTIFY_PROC, aux_copy_proc,
  128.                 0);
  129.         aux_win_mode_item[awi]= panel_create_item(aux_panel[awi], PANEL_CYCLE,
  130.                 PANEL_LABEL_Y, ATTR_ROW(0),
  131.                 PANEL_LABEL_X, ATTR_COL(25),
  132.                 PANEL_DISPLAY_LEVEL, PANEL_CURRENT,
  133.                 PANEL_LABEL_STRING, "Mode:",
  134.                 PANEL_CHOICE_STRINGS, "SimulView","AllPurpose",0,
  135.                 PANEL_VALUE, aux_win_mode[awi],
  136.                 PANEL_NOTIFY_PROC, aux_win_mode_proc,
  137.                 0);
  138.         aux_x_item[awi]= panel_create_item(aux_panel[awi], PANEL_CYCLE,
  139.                 PANEL_LABEL_Y, ATTR_ROW(1),
  140.                 PANEL_LABEL_X, ATTR_COL(0),
  141.                 PANEL_DISPLAY_LEVEL, PANEL_CURRENT,
  142.                 PANEL_LABEL_STRING, "Aux Plane:",
  143.                 PANEL_CHOICE_STRINGS, ALL_LABELS,0,
  144.                 PANEL_VALUE, aux_cur_index[awi][0],
  145.                 PANEL_NOTIFY_PROC, aux_x_proc,
  146.                 0);
  147.         aux_y_item[awi]= panel_create_item(aux_panel[awi], PANEL_CYCLE,
  148.                 PANEL_LABEL_Y, ATTR_ROW(1),
  149.                 PANEL_LABEL_X, ATTR_COL(20),
  150.                 PANEL_DISPLAY_LEVEL, PANEL_CURRENT,
  151.                 PANEL_LABEL_STRING, ":",
  152.                 PANEL_CHOICE_STRINGS, ALL_LABELS,0,
  153.                 PANEL_VALUE, aux_cur_index[awi][1],
  154.                 PANEL_NOTIFY_PROC, aux_y_proc,
  155.                 0);
  156.         sprintf(string, "%lg", aux_x_min[aux_cur_index[awi][0]][awi]);
  157.         aux_x_min_item[awi] = panel_create_item(aux_panel[awi], PANEL_TEXT,
  158.                         PANEL_LABEL_Y, ATTR_ROW(2),
  159.                         PANEL_LABEL_X, ATTR_COL(0),
  160.                         PANEL_VALUE, string,
  161.                         PANEL_VALUE_DISPLAY_LENGTH, 12,
  162.                         PANEL_LABEL_STRING,"[Hor]:",
  163.                         0);
  164.         sprintf(string, "%lg", aux_x_max[aux_cur_index[awi][0]][awi]);
  165.         aux_x_max_item[awi] = panel_create_item(aux_panel[awi], PANEL_TEXT,
  166.                         PANEL_LABEL_Y, ATTR_ROW(2),
  167.                         PANEL_LABEL_X, ATTR_COL(20),
  168.                         PANEL_VALUE, string,
  169.                         PANEL_VALUE_DISPLAY_LENGTH, 12,
  170.                         PANEL_LABEL_STRING,":",
  171.                         0);
  172.         sprintf(string, "%lg", aux_x_min[aux_cur_index[awi][1]][awi]);
  173.         aux_y_min_item[awi] = panel_create_item(aux_panel[awi], PANEL_TEXT,
  174.                         PANEL_LABEL_Y, ATTR_ROW(3),
  175.                         PANEL_LABEL_X, ATTR_COL(0),
  176.                         PANEL_VALUE, string,
  177.                         PANEL_VALUE_DISPLAY_LENGTH, 12,
  178.                         PANEL_LABEL_STRING,"[Ver]:",
  179.                         0);
  180.         sprintf(string, "%lg", aux_x_max[aux_cur_index[awi][1]][awi]);
  181.         aux_y_max_item[awi] = panel_create_item(aux_panel[awi], PANEL_TEXT,
  182.                         PANEL_LABEL_Y, ATTR_ROW(3),
  183.                         PANEL_LABEL_X, ATTR_COL(20),
  184.                         PANEL_VALUE, string,
  185.                         PANEL_VALUE_DISPLAY_LENGTH, 12,
  186.                         PANEL_LABEL_STRING,":",
  187.                         0);
  188.         window_fit_height(aux_panel[awi]);
  189.  
  190.     if(panel_colormap_on)
  191.             init_panel_colormap((Pixwin *) window_get(aux_panel[awi],WIN_PIXWIN), "aux_cms");
  192. }
  193.